home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / MacPerl 506 appl folder.sit / MacPerl 506 appl folder / Mac_Perl_506r1m_appl / lib / AutoLoader.pm < prev    next >
Text File  |  1995-03-19  |  707b  |  28 lines

  1. package AutoLoader;
  2. use Carp;
  3.  
  4. AUTOLOAD {
  5. #    my $name = "auto/$AUTOLOAD.al";
  6. #    $name =~ s#::#/#g;
  7.     my $name = ":auto:$AUTOLOAD.al";
  8.     $name =~ s#::#:#g;
  9.     eval {require $name};
  10.     if ($@) {
  11.     # The load might just have failed because the filename was too
  12.     # long for some old SVR3 systems which treat long names as errors.
  13.     # If we can succesfully truncate a long name then it's worth a go.
  14.     # There is a slight risk that we could pick up the wrong file here
  15.     # but autosplit should have warned about that when splitting.
  16.     if ($name =~ s/(¥w{12,})¥.al$/substr($1,0,11).".al"/e){
  17.         eval {require $name};
  18.     }
  19.     if ($@){
  20.         $@ =~ s/ at .*¥n//;
  21.         croak $@;
  22.     }
  23.     }
  24.     goto &$AUTOLOAD;
  25. }
  26.  
  27. 1;
  28.